package com.bw.gmall.realtime.utils;

import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;

import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

public class KeyWordUtil_zyj {
    public static List<String> splitKeyword(String keyword) throws IOException {
        ArrayList<String> list = new ArrayList<>();
        StringReader stringReader = new StringReader(keyword);
        IKSegmenter ikSegmenter = new IKSegmenter(stringReader, true);
        Lexeme next = ikSegmenter.next();
        while (next!=null){
            String word = next.getLexemeText();
            list.add(word);
            next = ikSegmenter.next();
        }
        return list ;

    }

    public static void main(String[] args) throws IOException {
        for (String a : KeyWordUtil_zyj.splitKeyword("辉煌八维大数据")) {
            System.out.println(a);
        }
    }
}
